/*
 * @Author: moonwater 13812995013@163.com
 * @Date: 2025-03-04 15:40:09
 * @LastEditors: moonwater 13812995013@163.com
 * @LastEditTime: 2025-03-04 15:41:04
 * @FilePath: \盐师22Git仓库\day07\ClearBit.java
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
package day07;

public class ClearBit {
    public static int clearBit(int v, int n) {
        return v & ~(1 << n);
    }
 
    public static void main(String[] args) {
        int v = 14; // 示例值，二进制表示为 1110
        int n = 2; // 要将第2位清零
        
        int result = clearBit(v, n);
        
        // 打印结果值及其二进制表示
        System.out.println("Original value: " + v + " (" + Integer.toBinaryString(v) + ")");
        System.out.println("Modified value: " + result + " (" + Integer.toBinaryString(result) + ")");
    }
}
